#ifndef __PCA9685_H
#define __PCA9685_H
#endif


#include "stm32f4xx_hal.h"
#include "./IIC/myiic.h"

#define PCA9685_adrr 0x80
#define PCA9685_SUBADR1 0x2
#define PCA9685_SUBADR2 0x3
#define PCA9685_SUBADR3 0x4

#define PCA9685_MODE1 0x0
#define PCA9685_PRESCALE 0xFE


#define LED0_ON_L 0x6
#define LED0_ON_H 0x7
#define LED0_OFF_L 0x8
#define LED0_OFF_H 0x9

#define ALLLED_ON_L 0xFA
#define ALLLED_ON_H 0xFB
#define ALLLED_OFF_L 0xFC
#define ALLLED_OFF_H 0xFD

void PCA9685_write(unsigned char reg,unsigned char data);
uint8_t PCA9685_read(unsigned char reg);
void setPWMFreq(uint8_t freq);
void setPWM(uint8_t num, uint16_t on, uint16_t off);
void down(void);
void up(void);
void chout(uint8_t chx,uint8_t angle);
void pca9685_reset(void);










